package com.xh.springCloud.zuul.server;

import com.netflix.zuul.FilterFileManager;
import com.netflix.zuul.FilterLoader;
import com.netflix.zuul.groovy.GroovyCompiler;
import com.netflix.zuul.groovy.GroovyFileFilter;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * Created by xuhao on 2016/11/30.
 */
@Component
public  class GroovyCommondLinner implements CommandLineRunner {
    @Override
    public void run(String... args) throws Exception {
        FilterLoader.getInstance().setCompiler(new GroovyCompiler());
        try {
            FilterFileManager.setFilenameFilter(new GroovyFileFilter());
            FilterFileManager.init(10,"/groovy");
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}